﻿
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using NetCore.BLL;
using NetCore.Model;
using NetCore.WS;
using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;

namespace NetCore.Admin.Web.Controllers
{
    public class ApiController : AreaController
    {
        public ISocketService myHubContext { get; set; }
        public IActionResult CacheClear()
        {
            AppHttpContext.CacheService.Clear();
            return Ok(AjaxResult.Success("成功"));
        }
       
        public IActionResult SendMessage([FromBody]SocketMessageModel socketModel)
        {
            if (myHubContext.Send(socketModel))
            {
                return Json(AjaxResult.Success());
            }
            return Json(AjaxResult.Error());
        }
    }
}
